package com.ldb.Controller.service;

import java.util.List;

import com.ldb.Controller.dao.BaseDao;
import com.ldb.Controller.dao.StudentDao;
import com.ldb.Controller.entity.Student;

public class StudentManager{

	private StudentDao studentDao;
	
	public void setStudentDao(StudentDao studentDao) {
		this.studentDao = studentDao;
	}
	
	public StudentDao getStudentDao() {
		return studentDao;
	}

	public void addStudent(Student student) {
		studentDao.addEntity(student);
	}
	
	public Student getStudentById(String id){
		this.studentDao.setClazz(Student.class);
		return this.studentDao.getEntity("student_id", id,Student.class);
	}
	
	public boolean updateStudent(String id,Student student) {
		this.studentDao.setClazz(Student.class);
		return this.studentDao.updateEntity(id, student);
	}
	
	public boolean deleteStudent(String id) {
		this.studentDao.setClazz(Student.class);
		return this.studentDao.deleteEntity(Student.class,id);
	}
	
	public List<Student> getStudentByName(String key,String value){
		this.studentDao.setClazz(Student.class);
		return this.studentDao.getEntityList(key, value);
	}
	
	public List<Student> getAllStudent(){
		this.studentDao.setClazz(Student.class);
		return this.studentDao.getEntityAll();
	}
}
